package com.alipay.sofa.award.biz.service.facade;

import com.alipay.sofa.award.common.dal.dataobject.Award;

/**
 * ActivityAwardFacade
 *
 * @author yangguanchao
 * @since 2018/08/28
 */
public interface ActivityAwardFacade {

    int deleteByPrimaryKey(Integer id);

    int deleteByActivityTime(String activityTime);

    int insert(Award record);

    int insertWhenNoExistWithActivityTimeAndRank(Award award);

    Award selectByPrimaryKey(Integer id);

    int updateByPrimaryKey(Award record);

    int updateByActivityTimeAndRank(Award record);

    int updateActivityTime(String oldActivityTime, String updatedActivityTime);

    /**
     * @param userId userId
     * @param activityTime activityTime
     * @param rank         level
     * @return if null no award acquire
     */
    Award tryWinLottery(String userId, String activityTime, String rank);

    int updateAwardByRankWithSameCount(Award dynamicAward);
}
